package com.guo.hui.util;

import java.util.List;
import java.util.Properties;

import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;

import com.mongodb.BasicDBObject;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;

/**
 * @ClassName MongoDBUtil
 * @Description TODO
 * @Author zhengguohui
 * @Date 2018/6/26 15:26
 */
public class MongoManager {

	private static MongoClient con = new MongoClient();

	private static MongoDatabase db = con.getDatabase("demo");

	public static MongoCollection<Document> getCollection(String collectionName) {
		return db.getCollection(collectionName);
	}

	// public static void saveDb(List<Document> docs) {
	// collection.insertMany(docs);
	// }
	//
	// public void update(BasicDBObject query, BasicDBObject update) {
	// BasicDBObject update1 = new BasicDBObject();
	// update1.put("$set", update);
	// collection.updateOne(query, update1);
	// }
}
